/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model.DAO;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 *
 * @author Hieu.Nguyen
 */
public class ConnectionFactory {
    static String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    static String url = "jdbc:sqlserver://localhost:1434;databaseName=dtbHotelMgmtSystem2;user=sa;password=123456";
    
    private static Connection connection;
    public static Connection getConnection() throws Exception{
        Class.forName(driver);        
        if(connection == null){
            connection = DriverManager.getConnection(url);
        }        
        return connection;        
    }
}
